<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="权限模板" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="goAdd()"
                            ng-disabled="!btnPermission.templateAdd" title="{{!btnPermission.templateAdd?'无权限执行此操作':''}}">新增</button>
                    <button class="btn btn-operate" ng-click="batchDel()"
                            ng-disabled="!btnPermission.templateDel" title="{{!btnPermission.templateDel?'无权限执行此操作':''}}">删除</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                    </div>
                </div>
            </div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table border-none">
                            <thead>
                            <tr>
                                <th width="40" class="text-center">
                                    <div yb-check-box yb-checked="markInfo.allChecked" yb-click="selectAll()"></div>
                                </th>
                                <th width="25%">模版名称</th>
                                <th width="25%">模版描述</th>
                                <th width="25%">客户端</th>
                                <th width="25%">操作</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0">
                        <table class="table border-none">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index" ng-class="{'row-selected': item.id === currentScepter.id}"
                                ng-click="getScepter(item)">
                                <td class="text-center" width="40">
                                    <div yb-check-box yb-checked="item.isChecked" yb-click="selectSingle(item)"></div>
                                </td>
                                <td width="25%" title="{{item.name}}">{{item.name}}</td>
                                <td width="25%" title="{{item.remark}}">{{item.remark}}</td>
                                <td width="25%" title="{{item.site|SiteType}}">{{item.site|SiteType}}</td>
                                <td width="25%" class="font-0">
                                    <button class="btn btn-operate m-r-xs" ng-click="goSetTemp(item)"
                                            ng-disabled="!btnPermission.templateConfig" title="{{!btnPermission.templateConfig?'无权限执行此操作':''}}">设置模版</button>
                                    <button class="btn btn-operate m-r-xs" ng-click="goEdit(item)"
                                            ng-disabled="!btnPermission.templateEdit" title="{{!btnPermission.templateEdit?'无权限执行此操作':''}}">编辑</button>
                                    <button class="btn btn-operate" ng-click="delData($index,$event)"
                                            ng-disabled="!btnPermission.templateDel" title="{{!btnPermission.templateDel?'无权限执行此操作':''}}">删除</button>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm p-b clearfix">
                <div yb-check-box class="m-r-sm" yb-checked="markInfo.allChecked" yb-check-name="全选" yb-click="selectAll()"></div>
                <button class="btn btn-operate" ng-click="batchDel()"
                        ng-disabled="!btnPermission.templateDel" title="{{!btnPermission.templateDel?'无权限执行此操作':''}}">删除</button>
            </div>
        </div>
        <div tab heading="{{tabFlag.name}}" active="activeFlag[1]" ng-if="activeFlag[1]">
            <div class="main-area d-t-35 d-b-60">
                <form name="dataForm" class="main-wrap form-horizontal single-col p-t clearfix" novalidate>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>模版名称：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="name" class="form-control" ng-model="detailInfo.name"
                                   maxlength="20" required yb-focus>
                        </div>
                        <div class="col-xs-4 msg-block"
                             ng-show="dataForm.name.$dirty || (dataForm.name.$invalid && submitted)">
                            <div class="error-msg" ng-if="dataForm.name.$error.required && !dataForm.name.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>客户端：</label>
                        <div class="col-xs-5 wrapper-none">
                            <select name="site" class="form-control" ng-model="detailInfo.site" required yb-focus>
                                <option value="">请选择</option>
                                <option value="1">供应商/外协仓/中转仓</option>
                                <option value="2">承运商</option>
                            </select>
                        </div>
                        <div class="col-xs-4 msg-block"
                             ng-show="dataForm.site.$dirty || (dataForm.site.$invalid && submitted)">
                            <div class="error-msg" ng-if="dataForm.site.$error.required && !dataForm.site.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">模版描述：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="remark" class="form-control" ng-model="detailInfo.remark" maxlength="20">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"></label>
                        <div class="col-xs-5 wrapper-none">
                            <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(dataForm.$valid)">
                                保存
                            </button>
                            <button type="button" class="btn btn-default" ng-click="changeTab(0)">取消</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div tab heading="设置模板权限" active="activeFlag[2]" ng-if="activeFlag[2]">
            <div class="panel-bar m-t-sm clearfix">
                <div class="pull-left">
                    <i></i>当前模版：{{currentScepter.name}}
                </div>
            </div>
            <div class="main-area d-b-60">
                <div class="main-wrap group" ng-init="open = false">
                    <div class="group-item" ng-repeat="item in menuList">
                        <div class="group-item-head">
                            <div yb-check-box yb-checked="item.isChecked" yb-check-name="{{item.name}}" yb-click="changeState(item)"></div>
                            <span ng-switch="open" ng-click="open = !open" ng-show="item.children.length > 0">
                                <span ng-switch-when="false">展开 <i class="yb-icon ico-angle-double-down font-12"></i></span>
                                <span ng-switch-when="true">收起 <i class="yb-icon ico-angle-double-up font-12"></i></span>
                            </span>
                        </div>
                        <div class="group-item-body" ng-show="open">
                            <div class="group-item" ng-repeat="subItem in item.children">
                                <div class="group-item-head">
                                    <div yb-check-box yb-checked="subItem.isChecked" yb-check-name="{{subItem.name}}" yb-click="changeState(subItem)"></div>
                                </div>
                                <div class="group-item-body p-t-n p-b-n clearfix" ng-if="subItem.state !== 'app.enterprise.ratingManager'"
                                     ng-show="subItem.leaf === 0 && subItem.children.length > 0">
                                    <div class="group-item" ng-repeat="thdItem in subItem.children">
                                        <div class="group-item-head">
                                            <div yb-check-box yb-checked="thdItem.isChecked" yb-check-name="{{thdItem.name}}" yb-click="changeState(thdItem)"></div>
                                        </div>
                                        <div class="group-item-body p-l-xxl clearfix" ng-show="thdItem.leaf === 1 && thdItem.auths.length > 0">
                                            <span class="info-color">操作权限：</span>
                                            <div yb-check-box ng-repeat="auth in thdItem.auths" class="m-r-md"
                                                 yb-checked="authCode[auth.authId]" yb-check-name="{{auth.authName}}" yb-click="selectAuth(auth.authId, thdItem)"></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="group-item-body p-l-xxl clearfix" ng-if="subItem.state !== 'app.enterprise.ratingManager'"
                                     ng-show="subItem.leaf === 1 && subItem.auths.length > 0">
                                    <span class="info-color">操作权限：</span>
                                    <div yb-check-box  ng-repeat="auth in subItem.auths" class="m-r-md"
                                         yb-checked="authCode[auth.authId]" yb-check-name="{{auth.authName}}" yb-click="selectAuth(auth.authId, subItem)"></div>
                                </div>
                                <div class="group-item-body p-l-xxl clearfix" ng-if="subItem.state === 'app.enterprise.ratingManager'"
                                     ng-repeat="item in ratingAuthList">
                                    <div class="m-b-xs">{{item.name}}</div>
                                    <span class="info-color">操作权限：</span>
                                    <div yb-check-box  ng-repeat="child in item.auths" class="m-r-md"
                                         yb-checked="authCode[child.authId]" yb-check-name="{{child.name}}" yb-click="selectAuth(child.authId, subItem)"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="bottom-area btn-bar text-center border-t clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-click="saveTemplate()">保存</button>
                <button type="button" class="btn btn-default" ng-click="changeTab(0)">取消</button>
            </div>
        </div>
    </div>
</div>